<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Posting.Master" Inherits="System.Web.Mvc.ViewPage<mesoBoard.Data.Post>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<% Thread TheThread = (Thread)ViewData["TheThread"]; %>

    <div class="bread_crumb left">
        <%= Html.BreadCrumbThreadLink(Model.PostID, 0) %>
    </div> 

    <fieldset>
        <legend><%= Html.ThemeImage("create_thread.png") %> Edit Thread</legend>
        
            <% if(ViewData["Preview"] != null && (bool)ViewData["Preview"]){ %>
                <% Html.RenderPartial("PostPreview", Model) ;%>
            <%} %>
        
        <form action="" method="post" enctype="multipart/form-data">
            <dl class="form">
                <% if(mesoBoard.Services.SiteConfig.AllowThreadImage.ToBool()){%>
                <dt>Image</dt>
                <dd>
                    <div class="create_thread_images">
                        <% Html.RenderAction("ThreadImages", "Post", new  { Field = "Image", Selected = TheThread.Image }); %>
                    </div>
                </dd>
                <% } else { %>
                    <%= Html.Hidden("Image", TheThread.Image) %>
                <% } %>
                
                <dt>Title</dt>
                <dd>
                    <%= Html.TextBox("Title", null, new { @class="title"})%>
                    <%= Html.ValidationMessage("Title") %>
                </dd>
                
                <dt>
                    <label>Message</label>
                    <table class="smilies">
                        <% Html.RenderAction("GetSmilies", "Post", new { x = 4, z = 20 }); %>
                        <tr><th colspan="4">more smilies</th></tr>
                    </table>                    
                </dt>
                <dd>
                    <%= Html.TextArea("Text", new { @class="posting bbcode"}) %>
                    <%= Html.ValidationMessage("Text") %>
                </dd>
                                
                <% Html.RenderPartial("EditThreadOptions", ViewData["UserPermissions"]); %>
                
                <dt>Post Options</dt>
                <dd>
                    <input type="checkbox" name="SubscribeToThread" id="SubscribeToThread" value="true" checked />
                    <label class="inline" for="SubscribeToThread">Subscribe to thread</label>
                    <br />
                    <input type="checkbox" name="UseSignature" id="UseSignature" value="true" 
                    <%= TheThread.FirstPost.User.UserProfile.AlwaysShowSignature ? "checked" : ""  %> />
                    <label class="inline" for="UseSignature">Use signature</label>
                </dd>
                <dt>&nbsp;</dt>
                <dd>
                    <%= Html.Hidden("UserID") %>
                    <%= Html.Hidden("Date") %>
                    <%= Html.Hidden("ThreadID") %>
                    <%= Html.Hidden("PostID") %>
                    <%= Html.SubmitButton("SaveChanges", "Save Changes")%>
                    <button type="submit" name="Preview" value="true">Preview Thread</button>
                    <%= Html.AntiForgeryToken() %>
                    <%= Html.ValidationMessage("TimeBetweenPosts") %>
                </dd>
                
            </dl>
        </form>
        
        <% Html.RenderAction("ThreadReview", "Post", new { ThreadID = Model.ThreadID }); %>
        
    </fieldset>
    
</asp:Content>
